/*Set-Up */
#delimit;
pause on;
clear;
pause;
set mem 15m;
pause;
set more off;
pause;
cd "C:\data\Kaccess";
log using Kaccess_Nov2306, replace;
pause;
use Firm_Level, clear;
pause;
save Merged_PCI, replace;
pause;

sort prov_id;
merge prov_id using Province_Level;
save Merged_PCI, replace;
pause;


/*New Variables*/
replace a8_1=a8_3 if a8_1==.;


replace a1=. if a1 < 1900;
replace a2=. if a2 < 1900;
generate age1=2006-a1;

lab var age1 "Years since Establishment";

pause;

generate age2=2006-a2;
generate diff_age=a2-a1;
generate diff_ageABS=abs(diff_age);


/*Competition Interaction*/
generate comp_inter= LSOE_loans*ent_1000;

lab var comp_inter "Interaction between SOE loans and competition";

/*Telephones*/
generate telcap_04 = tel_04/pop_2004;

lab var telcap_04 "Telephones per Capita in 2004";
lab var distance_hnhcmc "Distance from Hanoi or HCMC";
lab var ent_1000 "Enterprises per 1000 in 2005 ln";

generate ln_ent1000plus = ln(ent_1000+1);
lab var ln_ent1000plus "Number of Registered Private Enterprises per 1000 citizens (ln)";
lab var LSOE_loans "Loans of 4 State Commercial Banks to SOEs/Total Lending";

sum ln_ent1000plus LSOE_loans, detail;

scatter ln_ent1000plus LSOE_loans, mlabel (province)  msize(zero) jitter(4) mlabsize(tiny)
xline(.23, lcolor(cranberry) lpattern(dash) noextend)  xtitl(, size(small)) 
ytitle(, size(small)) yline(.54, lcolor(cranberry) lpattern(dash) noextend) 
note(Dashed lines denote 75th percentile, size(vsmall));

graph save "Competition", replace;
pause;


lab var diff_ageABS "Difference between Entry and Registration";

sum age1 age2 diff_age;

/*Legal Status*/
replace a5=. if a5==5;

/* Bank Loan*/
replace a9=0 if a9==.;


/*Personal Connections*/
generate personal=h5_3+h5_4+h5_5;
impute personal a8_3 a12_3 a10_3 a5 f6 a1 a2 diff_ageABS  
a6_1 a6_2 a6_3 a6_4 a14a a14b a14c a14d a14e b4_1a  b4_2  b4_3_1_4, generate(personal_new);
replace personal_new=1 if personal_new>=.4 & personal_new<=1;
replace personal_new=0 if personal_new<.4;
lab var personal_new "Degree of Personal Connection with Local Government";

generate personal_dum= personal_new;
replace personal_dum=1 if personal_dum>0;
lab var personal_dum "Personal Connection with Local Government";
label define Relationship  0 "No Connection" 1 "Connection";
label values personal_dum Relationship;


generate family=5-f6;
impute family a8_3 a12_3 a10_3 a5 f6 a1 a2 diff_ageABS  
a6_1 a6_2 a6_3 a6_4 a14a a14b a14c a14d a14e b4_1a  b4_2  b4_3_1_4, generate(family2);
lab var family2 "Importance of Family and Friends in Relations with Government";
pause;


/*SOE Connections*/
generate firm_connect= h5_1+ h5_2+ h5_6+ h5_7;
generate firmconnect_dum=firm_connect;
replace  firmconnect_dum =1 if  firmconnect_dum>0;
lab var firmconnect_dum "Firm Connection with Local Government";
tab  firmconnect_dum;

pause;


/*Access to Capital*/
generate kaccess=e1_12;
replace kaccess=6 if kaccess==9;
replace kaccess=7-kaccess;
lab var kaccess "Rating of Access to State Bank Loans";

generate high_KSOE=1 if LSOE_loans>=.23;
replace high_KSOE=0 if LSOE_loans<.23;

lab var high_KSOE "Over 50% of State Bank Loans to SOES";

pause;

/*Describe All Variables*/
describe;

/*Loans*/

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a, cluster(prov_id);
outreg2 using Loan, e(all) replace;
pause; 

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a  h5_1 h5_2 h5_3 h5_4 h5_5 h5_6 h5_7, 
cluster(prov_id);
outreg2 using Loan, e(all);
pause;  

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2, cluster(prov_id);
outreg2 using Loan, e(all);
pause; 

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a family2 h5_1 h5_2, cluster(prov_id);
outreg2 using Loan, e(all);
pause; 

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using Loan, e(all);
pause; 

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus 
comp_inter, cluster(prov_id);
outreg2 using Loan, e(all);
pause; 

dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Loan, e(all);
pause; 

dprobit a9 a8_3 a10_3  a12_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Loan, e(all);
pause; 

estsimp probit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id) genname (sim);

setx personal_new 0 h5_1 0 h5_2 0;
simqi;

setx personal_new 1 h5_1 0 h5_2 0;
simqi;

setx personal_new 2 h5_1 0 h5_2 0;
simqi;

setx personal_new 3 h5_1 0 h5_2 0;
simqi;


setx h5_1 0 h5_2 0;

simqi fd(pr), changex(personal_new 0 1);
simqi fd(pr), changex(personal_new 1 2);
simqi fd(pr), changex(personal_new 2 3);
simqi fd(pr), changex(personal_new 0 3);

pause;


xi3: dprobit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Loan;

xi3: probit a9 a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);


postgr3 ln_ent1000plus, by (high_KSOE) blwidth(thick)ylabel (.15(.05).55, labsize(medsmall)) 
ytitle("Predicted Probability of Receiving a Loan",  size(medsmall)) xtitle("Number of Enterprises per 1000 citizens in 2005 (Natural Log)",
size(medsmall)) clpatter("_") legend(label ( 1 Low Percentage of Loans to State Owned Enteprises)
label ( 2 High Percentage of Loans to State Owned Enteprises) rows(2) size(small));

graph save "Fig1_highloans", replace;
pause;


xi3: dprobit a9 a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Loan;

xi3: probit a9 a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);


postgr3 ln_ent1000plus, by (high_KSOE) blwidth(thick) sep(personal_dum) ylabel (.15(.05).55, labsize(medsmall)) 
ytitle("Predicted Probability of Receiving a Loan",  size(medsmall)) xtitle("Number of Enterprises per 1000 citizens in 2005 (Natural Log)",
size(medsmall)) clpatter("_") legend(label ( 1 Low Percentage of Loans to State Owned Enteprises)
label ( 2 High Percentage of Loans to State Owned Enteprises) rows(2) size(small));

graph save "Fig2a_highloans_per", replace;
pause;

generate p=personal_dum;

xi3: dprobit a9 a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a h5_1 h5_2 i.high_KSOE*ln_ent1000plus*p 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Loan, excel;

xi3: probit a9 a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a h5_1 h5_2 i.high_KSOE*ln_ent1000plus*p 
distance telcap_04 highschool pop_2004, cluster(prov_id);

postgr3 ln_ent1000plus, by (high_KSOE) blwidth(thick) sep(p) ylabel (.15(.05).55, labsize(medsmall)) 
ytitle("Predicted Probability of Receiving a Loan",  size(medsmall)) xtitle("Number of Enterprises per 1000 citizens in 2005 (Natural Log)",
size(medsmall)) clpatter("_") legend(label ( 1 Low Percentage of Loans to State Owned Enteprises)
label ( 2 High Percentage of Loans to State Owned Enteprises) rows(2) size(small));

graph save "Fig2NEW_highloans_per", replace;
pause;

/*KACCESS from State Banks*/

xi3: reg kaccess a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a, cluster(prov_id);
outreg2 using Kaccess, replace;
pause; 

xi3: reg kaccess a8_3 a10_3  age1 a6_1 a6_2 a6_3 a6_4 b4_1a  h5_1 h5_2 h5_3 h5_4 h5_5 h5_6 h5_7, 
cluster(prov_id);
outreg2 using Kaccess;
pause;  

xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2, cluster(prov_id);
outreg2 using Kaccess;
pause; 

xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a family2 h5_1 h5_2, cluster(prov_id);
outreg2 using Kaccess;
pause; 

xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using Kaccess;
pause; 

xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus 
comp_inter, cluster(prov_id);
outreg2 using Kaccess;
pause; 

xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Kaccess;
pause; 


xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Kaccess;

postgr3 ln_ent1000plus, by (high_KSOE);

graph save "Fig3_highaccess", replace;
pause;

xi3: reg kaccess a8_3 a10_3  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using Kaccess, excel;

postgr3 ln_ent1000plus, by (high_KSOE) sep (personal_dum);

graph save "Fig4a_highaccess", replace;
pause;

/*Robust to Lage - Loans*/

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a, cluster(prov_id);
outreg2 using LoanRob, e(all) replace;
pause; 

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a  h5_1 h5_2 h5_3 h5_4 h5_5 h5_6 h5_7, 
cluster(prov_id);
outreg2 using LoanRob, e(all);
pause;  

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2, cluster(prov_id);
outreg2 using LoanRob, e(all);
pause; 

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a family2 h5_1 h5_2, cluster(prov_id);
outreg2 using LoanRob, e(all);
pause; 

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using LoanRob, e(all);
pause; 

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus 
comp_inter, cluster(prov_id);
outreg2 using LoanRob, e(all);
pause; 

dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using LoanRob, e(all);
pause; 

dprobit a9 a8_2 a10_2 a12_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using LoanRob, e(all);
pause; 

xi3: dprobit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using LoanRob, e(all);

xi3: probit a9 a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);

postgr3 ln_ent1000plus, by (high_KSOE) blwidth(thick)ylabel (.15(.05).55, labsize(medsmall)) 
ytitle("Predicted Probability of Receiving a Loan",  size(medsmall)) xtitle("Number of Enterprises per 1000 citizens in 2005 (Natural Log)",
size(medsmall)) clpatter("_") legend(label ( 1 Low Percentage of Loans to State Owned Enteprises)
label ( 2 High Percentage of Loans to State Owned Enteprises) rows(2) size(small));


xi3: dprobit a9 a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using LoanRob, e(all);

xi3: probit a9 a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);

postgr3 ln_ent1000plus, by (high_KSOE) blwidth(thick) sep(personal_dum) ylabel (.15(.05).55, labsize(medsmall)) 
ytitle("Predicted Probability of Receiving a Loan",  size(medsmall)) xtitle("Number of Enterprises per 1000 citizens in 2005 (Natural Log)",
size(medsmall)) clpatter("_") legend(label ( 1 Low Percentage of Loans to State Owned Enteprises)
label ( 2 High Percentage of Loans to State Owned Enteprises) rows(2) size(small));

pause;

xi3: dprobit a9 a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a h5_1 h5_2 i.high_KSOE*ln_ent1000plus*p 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using LoanRob, e(all) excel;


/*KACCESS from State Banks*/

xi3: reg kaccess a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a, cluster(prov_id);
outreg2 using KaccessRob, replace;
pause; 

xi3: reg kaccess a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a  h5_1 h5_2 h5_3 h5_4 h5_5 h5_6 h5_7, 
cluster(prov_id);
outreg2 using KaccessRob;
pause;  

xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2, cluster(prov_id);
outreg2 using KaccessRob;
pause; 

xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a family2 h5_1 h5_2, cluster(prov_id);
outreg2 using KaccessRob;
pause; 

xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using KaccessRob;
pause; 

xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus 
comp_inter, cluster(prov_id);
outreg2 using KaccessRob;
pause; 

xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using KaccessRob;
pause; 


xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using KaccessRob;

postgr3 ln_ent1000plus, by (high_KSOE);

pause;

xi3: reg kaccess a8_2 a10_2  age1  a6_1 a6_2 a6_3 a6_4 b4_1a personal_dum h5_1 h5_2 i.high_KSOE*ln_ent1000plus 
distance telcap_04 highschool pop_2004, cluster(prov_id);
outreg2 using KaccessRob, excel;

postgr3 ln_ent1000plus, by (high_KSOE) sep (personal_dum);


pause;


pause;

/*Investment Grow*/
generate invest_grow = a8_3-a8_1 if a8_1 !=0;


generate invest_grow1 = a8_3-a8_2 if a8_2 !=0;



pause;


/*Labor Grow*/
generate labor_grow=a10_3-a10_1;


generat labor_grow1=a10_3-a10_2;



postgr3 a9, by(firmconn) table;
postgr3 a9, by(firmconn) table;


/*Expansion Plans*/
generate expansion_plans=.;
replace expansion_plans=6 if a11_1==1;
replace expansion_plans=5 if a11_2==1;
replace expansion_plans=4 if a11_3==1;
replace expansion_plans=3 if a11_4==1;
replace expansion_plans=2 if a11_5==1;
replace expansion_plans=1 if a11_6==1;

lab var expansion_plans "Plans over the Next Year";
tab expansion_plans;


/*Dependent Variables*/

lab var invest_grow "Total Investment Growth";
lab var invest_grow1 "1 Year Investment Growth";
lab var labor_grow1 "1 Year Labor Growth";

generate profit_grow= a12_3-a12_2;
lab var profit_grow "1 Profit Growth";

/*Final Model of Profit for Publication*/

/*Firm-Level Just Size*/
reg a12_3 a9 a8_2 a10_2, cluster(prov_id);
outreg2 using "Final Profit", replace;
/*More firm level factors*/
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e, cluster(prov_id);
outreg2 using "Final Profit";
/*With Structual Controls*/ 
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 , cluster(prov_id);
outreg2 using "Final Profit";
/*With Competition Variables*/
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final Profit";
/*With Governance*/
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus cases_per, cluster(prov_id);
outreg2 using "Final Profit";
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus unweighted, cluster(prov_id);
outreg2 using "Final Profit";
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus soebias, cluster(prov_id);
outreg2 using "Final Profit";
reg a12_3 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final Profit";
reg a12_3 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final Profit";
reg a12_3 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final Profit", excel;




/*Final Model of Profit Growth*/
/*Firm-Level Just Size*/
reg profit_grow a9 a8_2 a10_2, cluster(prov_id);
outreg2 using "Final ProfitGrow", replace;
/*More firm level factors*/
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e, cluster(prov_id);
outreg2 using "Final ProfitGrow";
/*With Structual Controls*/ 
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 , cluster(prov_id);
outreg2 using "Final ProfitGrow";
/*With Competition Variables*/
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final ProfitGrow";
/*With Governance*/
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus cases_per, cluster(prov_id);
outreg2 using "Final ProfitGrow";
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus unweighted, cluster(prov_id);
outreg2 using "Final ProfitGrow";
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus soebias, cluster(prov_id);
outreg2 using "Final ProfitGrow";
reg profit_grow a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final ProfitGrow";
reg profit_grow personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final ProfitGrow";
reg profit_grow personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final ProfitGrow", excel;

/*Final Model of Time*/
/*Firm-Level Just Size*/
reg a13 a9 a8_2 a10_2, cluster(prov_id);
outreg2 using "Final Time", replace;
/*More firm level factors*/
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e, cluster(prov_id);
outreg2 using "Final Time";
/*With Structual Controls*/ 
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 , cluster(prov_id);
outreg2 using "Final Time";
/*With Competition Variables*/
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final Time";
/*With Governance*/
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus cases_per, cluster(prov_id);
outreg2 using "Final Time";
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus unweighted, cluster(prov_id);
outreg2 using "Final Time";
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus soebias, cluster(prov_id);
outreg2 using "Final Time";
reg a13 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final Time";
reg a13 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final Time";
reg a13 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final Time", excel;


/*Final Model of 1 Year Investment Grow*/
/*Firm-Level Just Size*/
reg invest_grow1 a9 a8_2 a10_2, cluster(prov_id);
outreg2 using "Final Invest", replace;
/*More firm level factors*/
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e, cluster(prov_id);
outreg2 using "Final Invest";
/*With Structual Controls*/ 
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 , cluster(prov_id);
outreg2 using "Final Invest";
/*With Competition Variables*/
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final Invest";
/*With Governance*/
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus cases_per, cluster(prov_id);
outreg2 using "Final Invest";
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus unweighted, cluster(prov_id);
outreg2 using "Final Invest";
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus soebias, cluster(prov_id);
outreg2 using "Final Invest";
reg invest_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final Invest";
reg invest_grow1 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final Invest";
reg invest_grow1 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final Invest";

xi3: reg invest_grow1 h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal i.a9*personal_new, cluster(prov_id);
outreg2 using "Final Invest", excel;

postgr3 personal_new, by(a9) table;
pause;


/*Final Model of 1 Year Labor Grow*/
/*Firm-Level Just Size*/
reg labor_grow1 a9 a8_2 a10_2, cluster(prov_id);
outreg2 using "Final Invest", replace;
/*More firm level factors*/
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e, cluster(prov_id);
outreg2 using "Final labor";
/*With Structual Controls*/ 
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 , cluster(prov_id);
outreg2 using "Final labor";
/*With Competition Variables*/
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final labor";
/*With Governance*/
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus cases_per, cluster(prov_id);
outreg2 using "Final labor";
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus unweighted, cluster(prov_id);
outreg2 using "Final labor";
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus soebias, cluster(prov_id);
outreg2 using "Final labor";
reg labor_grow1 a9 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final labor";
reg labor_grow1 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
outreg2 using "Final labor";
reg labor_grow1 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Final labor";

xi3: reg labor_grow1 h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal i.a9*personal_new, cluster(prov_id);
outreg2 using "Final labor", excel;

postgr3 personal_new, by(a9) table;
pause;

/*Heckman Selection Bias*/

heckman a12_3 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age1 a14d a14e distance_hnhcmc highschool telcap_04 
urbpop_04 LSOE_loans ln_ent1000plus informal cases_per, 
select(a9 = a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004) cluster(prov_id);
outreg2 using "Heckman", replace;

heckman profit_grow personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age1 a14d a14e distance_hnhcmc highschool telcap_04 
urbpop_04 LSOE_loans ln_ent1000plus informal cases_per, 
select(a9 = a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004) cluster(prov_id);
outreg2 using "Heckman";

heckman invest_grow1 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age1 a14d a14e distance_hnhcmc highschool telcap_04 
urbpop_04 LSOE_loans ln_ent1000plus informal cases_per, 
select(a9 = a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004) cluster(prov_id);
outreg2 using "Heckman";

heckman a13 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age1 a14d a14e distance_hnhcmc highschool telcap_04 
urbpop_04 LSOE_loans ln_ent1000plus informal cases_per, 
select(a9 = a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004) cluster(prov_id);
outreg2 using "Heckman";

heckman labor_grow1 personal_new h5_1 h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age1 a14d a14e distance_hnhcmc highschool telcap_04 
urbpop_04 LSOE_loans ln_ent1000plus informal cases_per, 
select(a9 = a8_2 a10_2  age1 a6_1 a6_2 a6_3 a6_4 b4_1a personal_new h5_1 h5_2 LSOE_loans ln_ent1000plus comp_inter 
distance telcap_04 highschool pop_2004) cluster(prov_id);
outreg2 using "Heckman", excel;


/*Informality*/
poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance unweighted, cluster(prov_id);
outreg2 using "formality", replace;

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance entry, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance land, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance transparency, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance  time_costs, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance   informal, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance soebias, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance  proactivitysubindex, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance  psd, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance labor, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance legal, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance weight_2006rounded, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance LURC_prov, cluster(prov_id);
outreg2 using "formality";

poisson diff_ageABS age2 a5 a8_1 a6_1 a6_2 a6_3 a6_4  b4_1a  a14d a14e  telcap_04  firmconnect_dum
highschool distance  cases_cap, cluster(prov_id);
outreg2 using "formality", excel;

tab personal_dum;
tab personal_new;
tabstat a8_3 a10_3 a12_3 invest_grow1 profit_grow kaccess, by(personal_new) statistics (mean sd);
tabstat a8_3 a10_3 a12_3 invest_grow1 profit_grow kaccess, by(personal_dum) statistics (mean sd);
ttest a8_3, by(personal_dum) unequal;
ttest a10_3, by(personal_dum) unequal;
ttest a12_3, by(personal_dum) unequal;
ttest invest_grow1, by(personal_dum) unequal;
ttest profit_grow, by(personal_dum) unequal;
tab personal_new a9, row nofreq chi;
tab personal_dum a9, row nofreq chi;
tab personal_new h5_1, row nofreq chi;
tab personal_dum h5_1, row nofreq chi;
tab personal_new h5_2, row nofreq chi;
tab personal_dum h5_2, row nofreq chi;
tab personal_new h5_7, row nofreq chi;
tab personal_dum h5_7, row nofreq chi;


/*Expansion Plans*/
generate expansion_dich=1 if expansion_plans>=5;
replace expansion_dich=0 if expansion_plans<=4;

iis prov_id;

xi3: xtreg expansion_plans a9 a12_3 a8_3 a10_3 b4_1a a14d a14e, fe;
outreg2 using "Expand", replace;

xi3: xtreg expansion_plans i.a9*a12_3 a8_3 a10_3 b4_1a a14d a14e, fe;
outreg2 using "Expand";

xi3: xtreg expansion_plans i.a9*a12_3 a8_3 a10_3 b4_1a a14d a14e personal_dum, fe;
outreg2 using "Expand";

xi3: xtlogit expansion_dich  a9 a12_3 a8_3 a10_3 b4_1a a14d a14e, fe;
outreg2 using "Expand";

xi3: xtlogit expansion_dich i.a9*a12_3 a8_3 a10_3 b4_1a a14d a14e, fe;
outreg2 using "Expand";

xi3: xtlogit expansion_dich i.a9*a12_3 a8_3 a10_3 b4_1a a14d a14e personal_dum, fe;
outreg2 using "Expand", excel;

postgr3 a12_3, table by(a9) predict(xb)blwidth(thick) ylabel (, labsize(medsmall)) 
ytitle("Probability of Firm Expansion",  size(medsmall)) xtitle("Firm Profit in 2005 (8-Point Scale)",
size(medsmall)) clpatter("_") legend(label ( 1 No bank loan)
label ( 2 Firm presently has bank loan) rows(2) size(small));

graph save Expand, replace;


/*Interaction between equitization and relationship*/

tab h5_1 personal_new, row chi;
pause;

xi3: dprobit a9 a8_3 a10_3   age1 a6_1 a6_2 a6_3 a6_4 b4_1a  i.h5_1*personal_dum 
h5_2 LSOE_loans ln_ent1000plus comp_inter distance telcap_04 highschool pop_2004, cluster(prov_id);
pause;
outreg2 using "Equit_interaction", e(all) replace;

xi3: dprobit a9 a8_3 a10_3   age1 a6_1 a6_2 a6_3 a6_4 b4_1a  i.h5_1*personal_new 
h5_2 LSOE_loans ln_ent1000plus comp_inter distance telcap_04 highschool pop_2004, cluster(prov_id);
pause;
outreg2 using "Equit_interaction", e(all);

xi3: reg a12_3 i.h5_1*personal_new h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc 
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
pause;
outreg2 using "Equit_interaction", e(all);

xi3: reg a12_3 i.h5_1*personal_dum h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
pause;
outreg2 using "Equit_interaction", e(all);

xi3: reg  profit_grow i.h5_1*personal_new h5_2 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc 
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus informal, cluster(prov_id);
outreg2 using "Equit_interaction", e(all)  excel;


/*Disaggregation of Personal Relationships*/
pause;

dprobit a9 a8_3 a10_3 age1 a6_1 a6_2 a6_3 a6_4 b4_1a h5_1 h5_2 h5_3 h5_4 h5_5 LSOE_loans ln_ent1000plus comp_inter distance
telcap_04 highschool pop_2004, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all) replace;

dprobit a9 a8_3 a10_3 age1 a6_1 a6_2 a6_3 a6_4 b4_1a h5_3 h5_4 h5_5 h5_7 LSOE_loans ln_ent1000plus comp_inter distance
telcap_04 highschool pop_2004, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);

dprobit a9 a8_3 a10_3 age1 a6_1 a6_2 a6_3 a6_4 b4_1a h5_1 h5_2 family LSOE_loans ln_ent1000plus comp_inter distance
telcap_04 highschool pop_2004, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);

dprobit a9 a8_3 a10_3 age1 a6_1 a6_2 a6_3 a6_4 b4_1a family h5_7 LSOE_loans ln_ent1000plus comp_inter distance
telcap_04 highschool pop_2004, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);

reg a12_3 h5_1 h5_2 h5_3 h5_4 h5_5 a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);


reg a12_3  h5_3 h5_4 h5_5  h5_7  a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);

reg a12_3 h5_1 h5_2 family a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);


reg a12_3  family  h5_7  a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc
highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all);


xi3: reg a12_3  i.h5_7*h5_3  i.h5_7*h5_4  i.h5_7*h5_5     
a8_2 a10_2 a6_1 a6_2 a6_3 a6_4 b4_1a age2 a14d a14e distance_hnhcmc highschool telcap_04  urbpop_04 LSOE_loans ln_ent1000plus, cluster(prov_id);
pause;
outreg2 using "disaggregation", e(all)  excel;

postgr3 h5_7, by(h5_3) table;

save Merged_PCI, replace;

log close;
